package com.msgqu.share.utils;

import com.msgqu.share.domain.pub.SnowflakeId;

import java.util.*;

/**
 * @description: 生成id工具类
 * @author: wsj
 * @create: 2020-11-12 10:19
 * @throws:
 */
public class IdGeneratorUtil {

    /**
     * @description: 获取id long
     * @author: wsj
     * @create: 2020-11-12 16:18
     * @throws
     */
    public static long getLongId(){
        SnowflakeId snowflakeId = ApplicationContextHelper.getBeanByType(SnowflakeId.class);
        return snowflakeId.nextId();
    }

    /**
     * @description: 获取字符串id
     * @return: java.lang.String
     * @author: wsj
     * @create: 2020-11-12 16:21
     */
    public static String getStrId(){
        return String.valueOf(getLongId());
    }
    /**
     * @description: 获取uuid
     * @return: java.lang.String
     * @author: wsj
     * @create: 2020-11-12 16:30
     */
    public static String getUUID(){
        String uuid = UUID.randomUUID().toString();
        return uuid.replace("-","").toUpperCase();
    }
}
